package com.hshoesmall.demo.controller;

import com.hshoesmall.demo.common.api.ApiResult;
import com.hshoesmall.demo.model.entity.Type;
import com.hshoesmall.demo.mapper.TypeMapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/types")
public class TypeController {
    @Resource
    TypeMapper typeMapper;
//    获取所有类型
    @PostMapping("/getAllTypesForView")
    public ApiResult<List<Type>> getAllTypes(){
        typeMapper.findAllType();
        List<Type> allTypes = typeMapper.findAllType();
        return ApiResult.success(allTypes);
    }

}
